package com.wudi.estate.controller.controller;

import com.wudi.estate.service.admin.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @RequestMapping("/listUi")
    public String listUi(ModelMap map){
        try {
            List<Map<String, Object>> lists = roleService.selectRoleAndPermissions();
            map.addAttribute("lists",lists);
            System.out.println(lists);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  "role_list";
    }
    @RequestMapping("/addUi")
    public String addUi(ModelMap map){
        return "role_add";
    }
    @RequestMapping("/editUi")
    public String editUi(ModelMap map){
        return "role_edit";
    }
}
